<% layout('/layouts/default.html', {title: '修改完成进度', libs: ['validate']}){ %>
<div class="main-content">
	<div class="box box-main">
		<#form:form id="inputForm" model="${taskReceiveSix}" action="${ctx}/audit/taskReceive/updateRate" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('问题及建议')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<label class="control-label " title="" style="text-align: left">${taskReceiveSix.feedbackAdvice!'无'}</label>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required">*</span> 完成进度：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:hidden path="id"/>
								<#form:radio path="feedbackProgress" dictType="dc_feedback_progress" class="form-control required" />
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required">*</span> 完成率：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<div class="input-group">
									<#form:input path="feedbackRate" type="number" onblur="testRegx(this)" max="100" data-msg-rangelength="最大值100" dataFormat="number2" class="form-control required"/>
									<span class="input-group-addon">%</span>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('反馈人')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<label class="control-label " title="">${taskReceiveSix.feedbackName!'无'}</label>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('提 交')}</button>&nbsp;
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});

//完成率正则表达式校验
function testRegx(thisObj){

	let _this=thisObj;
	let k=/(^100([.]0{1,2})?)$|(^\d{1,2}([.]\d{1,2})?)$|(^([.]\d{1,2})?)$/;
	let thisValue=$(_this).val();
	if(k.test(thisValue)==false){
		if(thisValue.substring(0,1)=='-'){
			thisValue=thisValue.substring(1,thisValue.length)
		}
		let left = thisValue.substring(0,thisValue.indexOf("."))
		let right = thisValue.substring(thisValue.indexOf(".")+1,thisValue.indexOf(".")+3)
		$("#feedbackRate").val(left+'.'+right);
	}
}

// 选中事件
$('#feedbackProgress').on('ifChecked', function(){
	if($('#feedbackProgress input:radio:checked').val()=='3'){
		$('#feedbackRate').val(100);
		$('#feedbackRate').attr("readonly","readonly")
	}else {
		$('#feedbackRate').removeAttr("readonly");
		$('#feedbackRate').val('${taskReceiveSix.feedbackRate}');
	}
});
</script>